import ajax from './ajax'
import mockAjax from './mockAjax'
//获取分类导航
export const reqCategoryList=()=>ajax.get('/product/getBaseCategoryList')
//获取mock数据，首页轮播图数据及Floor层数据
export const reqBannerList=()=>mockAjax.get('/banner')
export const reqFloorsList=()=>mockAjax.get('/floors')
//搜索请求商品信息
export const reqGoodsInfo=(searchParams)=>ajax.post('/list',searchParams)
//获取商品详情
export const reqGoodDetailInfo=(skuId)=>ajax.get(`/item/${skuId}`)
//添加商品到购物车或修改购物车中的数量
export const reqAddOrUpdate=(skuId,skuNum)=>ajax.post(`/cart/addToCart/${skuId}/${skuNum}`)
//请求购物车数据
export const reqCartList=()=>ajax.get('/cart/cartList')

//删除购物车中某一商品
export const reqDeleteSkuInCart=(skuId)=>ajax.delete(`/cart/deleteCart/${skuId}`)
//切换购物车中商品选中状态
export const reqCheckSkuInCart=(skuId,isChecked)=>ajax.get(`/cart/checkCart/${skuId}/${isChecked}`)

//全选切换购物车商品状态
export const reqCheckAll=(isChecked,skuIdList)=>ajax.post(`/cart/batchCheckCart/${isChecked}`,skuIdList)

//批量删除
export const reqBatchDeleteCart=(skuIdList)=>ajax.delete('/cart/batchDeleteCart',{data:skuIdList})
//获取注册页面验证码 
export const reqVerifyCode=(phone)=>ajax.get(`/user/passport/sendCode/${phone}`)
//请求注册
/* 
params:{
    phone:'',
    password:'',
    code:''
}
*/
export const reqRegister=(registerParams)=>ajax.post('/user/passport/register',registerParams)
//登录
export const reqLogin=(loginParams)=>ajax.post('/user/passport/login',loginParams)
//获取个人信息
export const reqUserInfo=()=>ajax.get('user/passport/auth/getUserInfo')
//退出登录
export const reqLogout=()=>ajax.get('/user/passport/logout')
//请求用户地址
export const reqUserAddress=()=>ajax.get('/user/userAddress/auth/findUserAddressList')
//获取用户交易也信息
export const reqTradeInfo = ()=> ajax.get('/order/auth/trade')
//提交订单
/* 
{
    "consignee": "admin",
    "consigneeTel": "15011111111",
    "deliveryAddress": "北京市昌平区2",
    "paymentWay": "ONLINE",
    "orderComment": "xxx",
    "orderDetailList": [
        {
            "id": null,
            "orderId": null,
            "skuId": 6,
            "skuName": " Apple iPhone 11 (A2223) 128GB 红色 移动联通电信22",
            "imgUrl": "http://182.92.128.115:8080//rBFUDF6V0JmAG9XGAAGL4LZv5fQ163.png",
            "orderPrice": 4343,
            "skuNum": 2,
            "hasStock": null
        },
    ]
}

*/
export const reqSubmitOrder=(tradeNo,params)=>ajax.post(`/order/auth/submitOrder?tradeNo=${tradeNo}`,params)

//获取支付信息
export const reqPayInfo=(orderId)=>ajax.get(`/payment/weixin/createNative/${orderId}`)
//请求支付状态
export const reqPayStatus=(orderId)=>ajax.get(`/payment/weixin/queryPayStatus/${orderId}`)